package thread;

public class ThreadDemo1 {
    public static void main(String[] args) {
        MyThread1 thread1=new MyThread1();
        MyThread2 thread2=new MyThread2();
        thread1.start();
        thread2.start();//启动线程用start()，当我们调用start()方法后，线程就启动了，随后就用run()方法

    }
}
class MyThread1 extends Thread{//第一步继承Thread
    public void run(){//第二步重写run方法，run方法中是线程要执行的代码
        for (int i=0;i<1000;i++){
            System.out.println("你是谁啊？");
        }
    }
}

class  MyThread2 extends Thread{
    public void run(){
        for(int i=0;i<1000;i++){
            System.out.println("查水表的");
        }

    }
}
